﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Moki;
using Moki.State;

namespace Moki.Core
{
    /// <summary>
    /// Raises mock events. Changes state to Raising.
    /// </summary>
    internal class EventRaiser : IEventRaiser
    {
        private StateChangedNotifier _notifier = new StateChangedNotifier();

        public EventRaiser(StateController stateController)
        { 
            stateController.RegisterNotifier(_notifier);
        }

        public void Raise(Action action, object[] eventArgs)
        {
            _notifier.NotifyStateChanged(new StateEventArgs(MockingState.RaisingEvent, eventArgs));
            action();
            _notifier.NotifyStateChanged(MockingState.Acting);
        }
    }
}
